package cn.edu.zafu.bigdata.hdb;
// 父类 Animal
class Animal {
    public void makeSound() {
        System.out.println("Animal sound");
    }
}

// 子类 Dog 继承自 Animal
class Dog extends Animal {
    public void makeSound() {
        System.out.println("Woof!");
    }
}

// 子类 Cat 继承自 Animal
class Cat extends Animal {
    public void makeSound() {
        System.out.println("Meow!");
    }
}
public class TestAnimal {
    public static void main(String[] args) {
        // 创建 Dog 对象并调用 makeSound()
        Animal dog = new Dog();
        dog.makeSound(); // 输出: Woof!

        // 创建 Cat 对象并调用 makeSound()
        Animal cat = new Cat();
        cat.makeSound(); // 输出: Meow!
    }
}

